﻿<UserControl x:Class="Tisbi.LawFirm.UI.Views.Controls.CourtsListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="268" d:DesignWidth="631">
    <Grid DataContext="{Binding Source={StaticResource Locator}, Path=CourtsViewModel}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150"/>
            <ColumnDefinition Width="50"/>
            <ColumnDefinition Width="220"/>
            <ColumnDefinition Width="110"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50" MaxWidth="50"/>
                <ColumnDefinition Width="50" MaxWidth="50"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <mui:ModernButton Command="{Binding CreateCommand}" Grid.Row="0" Grid.Column="0" EllipseDiameter="32" HorizontalAlignment="Left" EllipseStrokeThickness="2" IconWidth="20" IconHeight="20" ToolTip="Добавить нового юриста" IconData="{StaticResource AddIconData}" Width="34" />
            <mui:ModernButton Command="{Binding EditCommand}" IsEnabled="{Binding CanEdit}" Grid.Row="0" Grid.Column="1" EllipseDiameter="32" HorizontalAlignment="Left" EllipseStrokeThickness="2" IconWidth="20" IconHeight="20" ToolTip="Редактировать дело" IconData="{StaticResource EditIconData}" Width="34" />
            <mui:ModernButton Command="{Binding RemoveCommand}" IsEnabled="{Binding CanRemove}" Grid.Row="0"  Grid.Column="2" EllipseDiameter="32" HorizontalAlignment="Left" EllipseStrokeThickness="2" IconWidth="20" IconHeight="20" ToolTip="Удалить юриста" IconData="{StaticResource RemoveIconData}" Width="34" />

            <mui:BBCodeBlock Visibility="{Binding HasVarnings}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Foreground="Red" Margin="5" BBCode="{Binding Varnings}" />
        </Grid>

        <!--Верхняя панель-->
        <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Content="Поиск" HorizontalAlignment="Left" />
        <TextBox Text="{Binding SearchCriteria}" Grid.Row="1" Grid.Column="2" />
        <Button Content="Найти" Command="{Binding Search}" Grid.Row="1" Grid.Column="3" Margin="5,5,0,5" HorizontalAlignment="Left" Width="100"/>
        <!--Таблица-->
        <StackPanel Grid.Row="2" Grid.ColumnSpan="5" Grid.Column="0" >
            <ScrollViewer>
                <DataGrid AutoGenerateColumns="False" IsReadOnly="True"
                      ItemsSource="{Binding Model}"
                      SelectedItem="{Binding SelectedModelItem, Mode=TwoWay}">
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=Id}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="№" />
                        <DataGridTextColumn Binding="{Binding Path=Title}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Название" />
                        <DataGridTextColumn Binding="{Binding Path=Phone}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Телефон" />
                        <DataGridTextColumn Binding="{Binding Path=Fax}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Факс" />
                        <DataGridTextColumn Binding="{Binding Path=Email}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Email" />
                        <DataGridTextColumn Binding="{Binding Path=Site}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Сайт" />
                        <DataGridTextColumn Binding="{Binding Path=Country}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Страна" />
                        <DataGridTextColumn Binding="{Binding Path=City}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Город" />
                        <DataGridTextColumn Binding="{Binding Path=District.Title}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Федеральный округ" />
                        <DataGridTextColumn Binding="{Binding Path=ZipCode}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Индекс" />
                        <DataGridTextColumn Binding="{Binding Path=Street}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Улица" />
                        <DataGridTextColumn Binding="{Binding Path=House}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Дом" />
                        <DataGridTextColumn Binding="{Binding Path=Housing}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Корпус" />
                        <DataGridTextColumn Binding="{Binding Path=CourtEmployees}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Место выдачи паспорта" />
                        <DataGridTextColumn Binding="{Binding Path=Jurisdiction}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Код подразделения" />
                    </DataGrid.Columns>
                </DataGrid>
            </ScrollViewer>
        </StackPanel>
    </Grid>
</UserControl>
